﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace KJSyncXP.Extensions
{
    public class AppConfigReader
    {
        public static AppConfig ReadConfig()
        {
            string configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "Appconfig.json");
            string json = File.ReadAllText(configPath);
            // 先反序列化为中间类
            var ConfigWrapper = JsonConvert.DeserializeObject<ConfigWrapper>(json);
            // 返回内部的AppConfig对象
            return ConfigWrapper.AppConfig;
        }
    }
}
